package com.store.service.hzl;

import com.store.entity.*;
import com.store.mapper.hzl.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClassName:Test
 * package:com.store.controller.hzl
 * Description:
 *
 * @Date:2021/1/16 19:23
 * @Author: tank_黄志凌
 */
@Service
public class IndexService {

    @Autowired
    private SellerMapper sellerMapper;

    @Autowired
    private BrandMapper brandMapper;

    @Autowired
    private TypeTemplateMapper typeTemplateMapper;

    @Autowired
    private ContentCategoryMapper contentCategoryMapper;

    @Autowired
    private SpecificationMapper specificationMapper;

    @Autowired
    private ContentMapper contentMapper;

    @Autowired
    private GoodsMapper goodsMapper;

    @Autowired
    private ItemCatMapper itemCatMapper;

    public List<Seller> querySellers(PageManager pm){
        int sellerPn=(pm.getPn()-1)*pm.getRn();
        int sellerRn=pm.getRn();
        return sellerMapper.querySeller(sellerPn,sellerRn);
    }

    public List<Brand> queryBrand(PageManager pm) {
        int brandPn=(pm.getPn()-1)*pm.getRn();
        int brandRn=pm.getRn();
        return brandMapper.queryBrand(brandPn,brandRn);
    }

    public List<Specification> querySpecification(PageManager pm) {
        int specificationPn=(pm.getPn()-1)*pm.getRn();
        int specificationRn=pm.getRn();
        return specificationMapper.querySpecification(specificationPn,specificationRn);
    }

    public List<TypeTemplate> queryTypeTemplate(PageManager pm) {
        int typeTemplatePn=(pm.getPn()-1)*pm.getRn();
        int typeTemplateRn=pm.getRn();
        return typeTemplateMapper.queryTypeTemplate(typeTemplatePn,typeTemplateRn);
    }

    public List<ContentCategory> queryContentCategory(PageManager pm) {
        int contentCategoryPn=(pm.getPn()-1)*pm.getRn();
        int contentCategoryRn=pm.getRn();
        return contentCategoryMapper.queryContentCategory(contentCategoryPn,contentCategoryRn);
    }

    public List<Content> queryContent(PageManager pm) {
        int contentPn=(pm.getPn()-1)*pm.getRn();
        int contentRn=pm.getRn();
        return contentMapper.queryContent(contentPn,contentRn);
    }

    public List<Goods> queryGoods(PageManager pm) {
        int goodsPn=(pm.getPn()-1)*pm.getRn();
        int goodsRn=pm.getRn();
        return goodsMapper.queryGoods(goodsPn,goodsRn);
    }

    public List<ItemCat> queryItemCat(PageManager pm) {
        int itemCatPn=(pm.getPn()-1)*pm.getRn();
        int itemCatRn=pm.getRn();
        return itemCatMapper.queryItemCat(itemCatPn,itemCatRn);
    }
}
